/**
 * hentaiImgs 此项内容不可描述
 * @param  onlyCode
 * @param  pageNumber
 * @param  imgUrl
 * @param  timestamps
 * @index  onlyCode
 **/
let knex = require('./database')
const tableName = 'hentaiImgs'
function getAll(fields, callback){
  return knex.select(fields)
    .table(tableName)
    .then(
      data => callback(data)
    )
}

function insertImg(code, page, url, callback){
  return knex(tableName).returning('id').insert({
    onlyCode: code,
    pageNumber: page,
    imgUrl: url
  })
    .then(
      data => callback(data[0])
    )
    .catch(err => {
      throw new Error(err)
    })

}

module.exports.getAll = getAll
module.exports.insertImg = insertImg



